
/**
 * Module dependencies.
 */

var express = require('express')
  , authen = require('./routes/api/authen')
  , fotola = require('./routes/api/fotola')
  , imageFotola = require('./routes/api/imageFotola')
  , friendFotola = require('./routes/api/friendFotola')
  //, test = require('./routes/test/test')
  , http = require('http')
  , path = require('path');

var app = express();

// all environments
app.set('port', process.env.PORT || 3001);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.post('/foto/apiAuthen/signUp', authen.signUp);
app.post('/foto/apiAuthen/login', authen.login);
app.post('/foto/apiAuthen/logout', authen.logout);
app.post('/foto/apiAuthen/updateProfile', authen.updateProfile);
app.post('/foto/apiAuthen/uploadAvatar', authen.uploadAvatar);
app.post('/foto/apiAuthen/getAvatar', authen.getAvatar);
app.post('/foto/apiFotola/createFotola', fotola.createFotola);
app.post('/foto/apiFotola/deleteFotola', fotola.deleteFotola);
app.post('/foto/apiFotola/updateFotola', fotola.updateFotola);
app.post('/foto/apiFotola/instantFotola', fotola.instantFotola);
app.post('/foto/apiFotola/listFotola', fotola.listFotola);
app.post('/foto/apiFotola/listPhotosOfFotola', imageFotola.listPhotosOfFotola);
app.post('/foto/apiFotola/listFotolaOfAccount', fotola.listFotolaOfAccount);
app.post('/foto/apiFotola/getThumbnail', imageFotola.getThumbnail);
app.post('/foto/apiFotola/getPhoto', imageFotola.getPhoto);
app.post('/foto/apiFotola/uploadPhoto', imageFotola.uploadPhoto );
app.post('/foto/apiFotola/listFriend', friendFotola.listFriend);
app.post('/foto/apiFotola/listFriendFotolaOfAccount', friendFotola.listFriendFotolaOfAccount);
app.post('/foto/apiFotola/addFriend', friendFotola.addFriend);
app.post('/foto/apiFotola/deleteFriend', friendFotola.deleteFriend);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});
